package cn.iocoder.yudao.module.aiposter.dal.mysql.poster;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.aiposter.controller.admin.poster.vo.PosterPageReqVO;
import cn.iocoder.yudao.module.aiposter.controller.app.poster.vo.req.AppPosterPageReqVO;
import cn.iocoder.yudao.module.aiposter.dal.dataobject.poster.PosterDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 用户组 Mapper
 *
 * @author Rain
 */
@Mapper
public interface PosterMapper extends BaseMapperX<PosterDO> {

    default PageResult<PosterDO> selectPage(PosterPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PosterDO>()
                .likeIfPresent(PosterDO::getTitle, reqVO.getTitle())
                .eqIfPresent(PosterDO::getBizName, reqVO.getBizName())
                .eqIfPresent(PosterDO::getKeyword, reqVO.getKeyword())
                .eqIfPresent(PosterDO::getTemplateId, reqVO.getTemplateId())
                .eqIfPresent(PosterDO::getCover, reqVO.getCover())
                .eqIfPresent(PosterDO::getData, reqVO.getData())
                .eqIfPresent(PosterDO::getWidth, reqVO.getWidth())
                .eqIfPresent(PosterDO::getHeight, reqVO.getHeight())
                .eqIfPresent(PosterDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(PosterDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PosterDO::getId));
    }
}